package com.narsimha.crosstab;

import com.gaurav.tree.NodeNotFoundException;
import com.google.visualization.datasource.datatable.DataTable;
import com.narsimha.crosstab.helper.DataToDsHelper;
import com.narsimha.crosstab.helper.StateHelper;
import com.narsimha.model.Dimension;
import com.narsimha.model.Measure;

public class PivotTable {
	
	public PivotTable(DataTable dt, Dimension[] xDimensions, Dimension[] yDimensions, Measure[] measures) {
		StateHelper.getInstance().setxDimensions(xDimensions);
		StateHelper.getInstance().setyDimensions(yDimensions);
		StateHelper.getInstance().setMeasures(measures);
		try {
			new DataToDsHelper().convert(dt);
		} catch (NodeNotFoundException e) {
			e.printStackTrace();
		}
	}
}